<?php
class orderformAction extends Action
{
	/**
	 * 工作人员修改出团通知书后的保存操作
	 */
	function savechutuanzzs()
	{
		if($_SESSION["Login"][1]=="" or $_SESSION["Login"][1]==null) die("您不是工作人员或没有登陆");
		
		$orderid=$_REQUEST["orderid"];
		$str="{@团号:".$_REQUEST["chutuhao"]."@}";
		$str.="{@集合接送:".$_REQUEST["jiejisongji"]."@}";
		$str.="{@集合接送:".$_REQUEST["jiejisongji"]."@}";
		if($_REQUEST["yukuanzhifu"]!="") $str.="{@余款支付说明:".$_REQUEST["yukuanzhifu"]."@}";
		$str.="{@供应商:".$_REQUEST["dangdilvyousang"]."@}";
		$str.="{@梦之旅联系信息:".$_REQUEST["contactinfo"]."@}";
		$str.="{@余款支付信息:".$_REQUEST["yukuanzhifu"]."@}";
		$id=$_REQUEST["id"];
		if(!is_numeric($id)) die("传入参数不正确");
		$mr=M("orderform");
		
		$data["orderform29"]=$str;
		
		
		if($mr->where("orderform0=".$id)->save($data))
		{
			
			alert("affirm_chutuantongzhi".FGF."orderid".FGF."".$orderid,2,"保存成功");
		}
		else
		{
			
			alert("affirm_chutuantongzhi".FGF."orderid".FGF."".$orderid,2,"保存失败");
		}
		
	}
	
	
	
	/**
	 * 保存国内合同内容
	 */
	function saveguoleihetong()
	{
		if($_SESSION["Login"][1]=="" or $_SESSION["Login"][1]==null) die("您不是工作人员或没有登陆");
		
		$orderid=$_REQUEST["orderid"];
		$str="{@jiafangname:".$_REQUEST["jiafangname"]."@}";//甲方名称
		$str.="{@Youraddress:".$_REQUEST["Youraddress"]."@}";//
		$str.="{@jiaemail:".$_REQUEST["jiaemail"]."@}";//
		$str.="{@Yourtel:".$_REQUEST["Yourtel"]."@}";//
		$str.="{@YiafangName:".$_REQUEST["YiafangName"]."@}";//
		$str.="{@jinyunXuKeZheng:".$_REQUEST["jinyunXuKeZheng"]."@}";//
		$str.="{@jinyunhuanwei:".$_REQUEST["jinyunhuanwei"]."@}";//
		$str.="{@Yitel:".$_REQUEST["Yitel"]."@}";//
		$str.="{@tuanno:".$_REQUEST["tuanno"]."@}";//
		$str.="{@protname:".$_REQUEST["protname"]."@}";//
		$str.="{@cfsd:".$_REQUEST["cfsd"]."@}";//
		$str.="{@JiaoTongJiBiaoZhun:".$_REQUEST["JiaoTongJiBiaoZhun"]."@}";//
		$str.="{@zylsd:".$_REQUEST["zylsd"]."@}";//
		$str.="{@ycsbz:".$_REQUEST["ycsbz"]."@}";//
		$str.="{@zxbz:".$_REQUEST["zxbz"]."@}";//
		$str.="{@gwanpai:".$_REQUEST["gwanpai"]."@}";//
		$str.="{@ZhiFeiXiangMu:".$_REQUEST["ZhiFeiXiangMu"]."@}";//
		$str.="{@daoyoufeiy:".$_REQUEST["daoyoufeiy"]."@}";//
		$str.="{@fyzfbf:".$_REQUEST["fyzfbf"]."@}";//
		$str.="{@zhifubanf:".$_REQUEST["zhifubanf"]."@}";//
		$str.="{@qtyy:".$_REQUEST["qtyy"]."@}";//
		$str.="{@ZhuanBinTuanTravel:".$_REQUEST["ZhuanBinTuanTravel"]."@}";//
		$str.="{@DiJieTravel:".$_REQUEST["DiJieTravel"]."@}";//
		$str.="{@beizhu:".$_REQUEST["beizhu"]."@}";//
		$str.="{@BaoXianGSLianXiRen:".$_REQUEST["BaoXianGSLianXiRen"]."@}";//
		$str.="{@LvYouFeiYongShuoMing1:".$_REQUEST["LvYouFeiYongShuoMing1"]."@}";//
		$str.="{@LvYouFeiYongShuoMing2:".$_REQUEST["LvYouFeiYongShuoMing2"]."@}";//
		$str.="{@QiTaFeiYong:".$_REQUEST["QiTaFeiYong"]."@}";//
		$str.="{@xdwp:".$_REQUEST["xdwp"]."@}";//
		$str.="{@SuangYueDing:".$_REQUEST["SuangYueDing"]."@}";//
		$str.="{@SuangYueDingYiZ:".$_REQUEST["SuangYueDingYiZ"]."@}";//
		$str.="{@cfrq:".$_REQUEST["cfrq"]."@}";//
		$str.="{@other1:".$_REQUEST["other1"]."@}";//
		$str.="{@other2:".$_REQUEST["other2"]."@}";//
		$str.="{@other3:".$_REQUEST["other3"]."@}";//
		$str.="{@other4:".$_REQUEST["other4"]."@}";//
		$str.="{@other5:".$_REQUEST["other5"]."@}";//
		$str.="{@jiafangAllPersren:".$_REQUEST["jiafangAllPersren"]."@}";//
		$str.="{@jiafangrenydb:".$_REQUEST["jiafangrenydb"]."@}";//
		$str.="{@yifangrenydb:".$_REQUEST["yifangrenydb"]."@}";//
		$str.="{@qanyuedate:".$_REQUEST["qanyuedate"]."@}";//
	
		$isqiand=$_REQUEST["orderform33"];//是否签定合同

		$id=$_REQUEST["id"];
		
		if(!is_numeric($id)) die("传入参数不正确");
		$mr=M("orderform");
		
		$data["orderform32"]=$str;
		$data["orderform33"]=$isqiand;
		
		
		if($mr->where("orderform0=".$id)->save($data))
		{
			$temp="";
			//当勾选了签定合同时，生成合同的静态文件
			if($isqiand=="1")
			{
				require_once RootDir.'/inc/ActionFile.class.php';
				$myfile=new ActionFile();
				$temp=($myfile->CreateAnyPageToPage("http://".$_SERVER['HTTP_HOST']."/affirm".FGF."guoleihetong".FGF."orderid".FGF."".$orderid, RootDir."/html/hetong/".$orderid.".htm"))?"生成静态成功":"生成静态失败";
			}
			alert("/affirm".FGF."guoleihetong".FGF."orderid".FGF."".$orderid."".FGF."showedit".FGF."yes",2,"保存成功".$temp);
		}
		else
		{
			alert("/affirm".FGF."guoleihetong".FGF."orderid".FGF."".$orderid."".FGF."showedit".FGF."yes",2,"保存失败");
		}
		
	}
	/**
	 * 保存出境合同
	 */
	function savechujinghetong()
	{
		if($_SESSION["Login"][1]=="" or $_SESSION["Login"][1]==null) die("您不是工作人员或没有登陆");
		$str.="{@hetongbianhao:".$_REQUEST["hetongbianhao"]."@}";//
		$str.="{@jiafangName:".$_REQUEST["jiafangName"]."@}";//
		$str.="{@Youraddress:".$_REQUEST["Youraddress"]."@}";//
		$str.="{@Email_send:".$_REQUEST["Email_send"]."@}";//
		$str.="{@Yourtel:".$_REQUEST["Yourtel"]."@}";//
		$str.="{@YifangName:".$_REQUEST["YifangName"]."@}";//	
		$str.="{@YicompanyAddress:".$_REQUEST["YicompanyAddress"]."@}";//	
		$str.="{@jinyunhuanwei:".$_REQUEST["jinyunhuanwei"]."@}";//
		$str.="{@jinyunXuKeZheng:".$_REQUEST["jinyunXuKeZheng"]."@}";//	
		$str.="{@Yitel:".$_REQUEST["Yitel"]."@}";//		
		$str.="{@tuanno:".$_REQUEST["tuanno"]."@}";//			
		$str.="{@CountryAndArea:".$_REQUEST["CountryAndArea"]."@}";//
		$str.="{@chufaTimeSTuan:".$_REQUEST["chufaTimeSTuan"]."@}";//	
		$str.="{@JiaoTongJiBiaoZhun:".$_REQUEST["JiaoTongJiBiaoZhun"]."@}";//
		$str.="{@zylsd:".$_REQUEST["zylsd"]."@}";//	
		$str.="{@ycsbz:".$_REQUEST["ycsbz"]."@}";//	
		$str.="{@zxbz:".$_REQUEST["zxbz"]."@}";//	
		$str.="{@gwanpai:".$_REQUEST["gwanpai"]."@}";//		
		$str.="{@ZhiFeiXiangMu:".$_REQUEST["ZhiFeiXiangMu"]."@}";//		
		$str.="{@daoyoufeiy:".$_REQUEST["daoyoufeiy"]."@}";//			
		$str.="{@fyzfbf:".$_REQUEST["fyzfbf"]."@}";//

		
		$str.="{@LvYouFeiYongBaoHanXuan:".implode("",$_REQUEST["LvYouFeiYongBaoHanXuan"])."@}";//	
		$str.="{@jiaotongfeiyong:".implode("",$_REQUEST["jiaotongfeiyong"])."@}";//	
		$str.="{@youleifeiy:".implode("",$_REQUEST["youleifeiy"])."@}";//	
		$str.="{@jiedaifeiyong:".implode("",$_REQUEST["jiedaifeiyong"])."@}";//	
		$str.="{@lvyoufuwufei:".implode("",$_REQUEST["lvyoufuwufei"])."@}";//		
		$str.="{@qitafeiyong:".implode("",$_REQUEST["qitafeiyong"])."@}";//	
		$str.="{@chanyingzhushu:".implode("",$_REQUEST["chanyingzhushu"])."@}";//	
		
		
		$str.="{@zfbf:".$_REQUEST["zfbf"]."@}";//		
		$str.="{@JiaoNaFangSi_zt:".implode("",$_REQUEST["JiaoNaFangSi_zt"])."@}";//		
		$str.="{@JiaoNaFangSi_xyk:".implode("",$_REQUEST["JiaoNaFangSi_zt"])."@}";//			
		$str.="{@JiaoNaFangSi_qita:".implode("",$_REQUEST["JiaoNaFangSi_qita"])."@}";//	
		$str.="{@JiaoNaFangSi_xj:".implode("",$_REQUEST["JiaoNaFangSi_xj"])."@}";//	
		$str.="{@zhuanbit:".$_REQUEST["zhuanbit"]."@}";//	
		$str.="{@bunenfatian:".$_REQUEST["bunenfatian"]."@}";//
		$str.="{@ZhuanBinTuanTravel:".$_REQUEST["ZhuanBinTuanTravel"]."@}";//
		$str.="{@DiJieTravel:".$_REQUEST["DiJieTravel"]."@}";//
		$str.="{@beizhu:".$_REQUEST["beizhu"]."@}";//	
		$str.="{@BaoXianGSLianXiRen:".$_REQUEST["BaoXianGSLianXiRen"]."@}";//	
		$str.="{@BaoXianGSLianXiRen:".$_REQUEST["BaoXianGSLianXiRen"]."@}";//	
		$str.="{@LvYouFeiYongShuoMing1:".$_REQUEST["LvYouFeiYongShuoMing1"]."@}";//		
		$str.="{@LvYouFeiYongShuoMing2:".$_REQUEST["LvYouFeiYongShuoMing2"]."@}";//			
		$str.="{@QiTaFeiYong:".$_REQUEST["QiTaFeiYong"]."@}";//		
		$str.="{@xdwpchuy:".$_REQUEST["xdwpchuy"]."@}";//		
		$str.="{@SuangYueDing:".$_REQUEST["SuangYueDing"]."@}";//	
		$str.="{@SuangYueDingYiZ:".$_REQUEST["SuangYueDingYiZ"]."@}";//	
		$str.="{@cfrq:".$_REQUEST["cfrq"]."@}";//		
		$str.="{@other1:".$_REQUEST["other1"]."@}";//			
		$str.="{@other2:".$_REQUEST["other2"]."@}";//			
		$str.="{@other3:".$_REQUEST["other3"]."@}";//		
		$str.="{@other4:".$_REQUEST["other4"]."@}";//
		$str.="{@other5:".$_REQUEST["other5"]."@}";//
		$str.="{@jiafangAllPersren:".$_REQUEST["jiafangAllPersren"]."@}";//	
		$str.="{@jiafangdaibiao:".$_REQUEST["jiafangdaibiao"]."@}";//		
		$str.="{@jiafangshengfengzheng:".$_REQUEST["jiafangshengfengzheng"]."@}";//		
		$str.="{@jiafangtelfax:".$_REQUEST["jiafangtelfax"]."@}";//	
		$str.="{@jiafengemail:".$_REQUEST["jiafengemail"]."@}";//		
		$str.="{@y_name:".$_REQUEST["y_name"]."@}";//		
		$str.="{@y_tel:".$_REQUEST["y_tel"]."@}";//		
		$str.="{@y_addr:".$_REQUEST["y_addr"]."@}";//
		$str.="{@y_email:".$_REQUEST["y_email"]."@}";//
		$str.="{@y_date:".$_REQUEST["y_date"]."@}";//
				
			
		$isqiand=implode("",$_REQUEST["orderform33"]);//是否签定合同
		$orderid=$_REQUEST["orderid"];
		$id=$_REQUEST["id"];
		
		if(!is_numeric($id)) die("传入参数不正确");
		$mr=M("orderform");
		$data["orderform32"]=$str;
		$data["orderform33"]=$isqiand;
		
		
		if($mr->where("orderform0=".$id)->save($data))
		{
			$temp="";
			//当勾选了签定合同时，生成合同的静态文件
			if($isqiand=="1")
			{
				require_once RootDir.'/inc/ActionFile.class.php';
				$myfile=new ActionFile();
				$temp=($myfile->CreateAnyPageToPage("http://".$_SERVER['HTTP_HOST']."/affirm".FGF."chujinghetong".FGF."orderid".FGF."".$orderid, RootDir."/html/hetong/".$orderid.".htm"))?"生成静态成功":"生成静态失败";
			}
			alert("/affirm".FGF."chujinghetong".FGF."orderid".FGF.$orderid.FGF."showedit".FGF."yes",2,"保存成功".$temp);
		}
		else
		{
			
			alert("/affirm".FGF."chujinghetong".FGF."orderid".FGF.$orderid.FGF."showedit".FGF."yes",2,"保存失败".$temp);
		}
		
	}
	
	
	
	/**
	 * 更新订单数据表里的内容
	 * @param $wheresql 条件
	 * @param $data  更新的数组
	 * @return 成功返回true 失败返回false
	 */
	function updatersonefiled($wheresql,$data)
	{
		$mr=M("orderform");
		if(!is_array($data)) return false;
		$num=$rs=$mr->where($wheresql)->save($data);
		return ($num)?true:false;
	}
	
	/**
	 * 客人在下单的时候生成订单
	 * @param $arr  参数组
	 * @return 成功true,失败false
	 */
	
	function createorder($arr){
		$rsc=M("orderform");
		if(is_array($arr)){
			$temp=$rsc->add($arr);
			return (is_numeric($temp))?true:false;
		}
		return false;
		
	}
	
	
}

?>